﻿Imports Entities
Public Class ParametrosDAL
    Public Shared Function GetParametros() As PARAMETROS
        Try
            Using bd As New gas_gasdesuvecinoEntities
                Return bd.PARAMETROS.SingleOrDefault
            End Using
        Catch ex As Exception
            Return Nothing
        End Try
    End Function
    Public Shared Function Create(ByVal zObject As PARAMETROS) As PARAMETROS
        Try
            Using bd As New gas_gasdesuvecinoEntities
                bd.PARAMETROS.Add(zObject)
                bd.SaveChanges()
                Return zObject
            End Using
        Catch ex As Exception
            Return Nothing
        End Try
    End Function
    Public Shared Function Update(ByVal zObject As PARAMETROS) As PARAMETROS
        Try
            Using bd As New gas_gasdesuvecinoEntities
                Dim query = bd.PARAMETROS.SingleOrDefault
                With query
                    .NOMBREEMPRESA = zObject.NOMBREEMPRESA
                    .DIRECCIONEMPRESA = zObject.DIRECCIONEMPRESA
                    .FONOEMPRESA = zObject.FONOEMPRESA
                    .GIROEMPRESA = zObject.GIROEMPRESA
                    .RAZONSOCIAL = zObject.RAZONSOCIAL
                    .RUTEMPRESA = zObject.RUTEMPRESA
                    .VALORIVA = zObject.VALORIVA
                    .VALORIVASM = zObject.VALORIVASM
                End With
                bd.SaveChanges()
                Return query
            End Using
        Catch ex As Exception
            Debug.Print("CamionDAL.Update() " + ex.Message)
            Return Nothing
        End Try
    End Function
End Class
